home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / SBOBZ.ARJ / SBOBZ.ASM < prev    next >
Assembly Source File  |  1994-12-23  |  7KB  |  232 lines

  1. ;"Great" tre hours project by LÖKÖ of Napalm Software
  2. ; I saw a message on our local support site Juho's Place BBS
  3. ; about the art of shade bobs.
  4. ; I decided to do my own shade bobs just for fun at christmas eve
  5.  
  6. ; I'm fucking tired because of all thiese "nice" TASM features.
  7. ; It took me fucking two hours to discover a bug in this eazy
  8. ; piezy of code. The only thing that was fucking wrong was that
  9. ; I used three fucking variables like this "mov si,xplace".
  10. ; normally this would work ok, but now the fucking program loaded
  11. ; the variable from the fucking DS segment instead of CS. And DS
  12. ; was pointing to the fucking font data. Fucking funny!
  13.  
  14. ; I have (OHO) optimized the code somehow, but there are still some
  15. ; bytes to crush. Anyway nice 1K intro?
  16.  
  17. cseg    segment
  18.         assume cs:cseg
  19.         org 0100h
  20.         .286
  21.  
  22. start:
  23.   mov ax,13h
  24.   int 10h
  25.  
  26. ;You could try the following three lines instead of INT 10h call 
  27. ;  push 0f000h
  28. ;  pop  ds     ;One byte smaller than "MOV AX,0f000h  MOV DS,AX"
  29. ;  mov  bp,0fa6eh
  30.         mov ax,01130h   ;Load 8x8 font pointer
  31.         mov bh,3
  32.         int 10h
  33.         push es
  34.         pop  ds
  35.         push 0a000h     ;ES points to vidmem. DS points to 8x8 font
  36.         pop  es
  37.  
  38.   mov dx,3c8h
  39.   xor ax,ax
  40.   out dx,al
  41.   inc dx
  42.   @pal_loop1: ;Set colors 0-62
  43.   out dx,al
  44.   out dx,al
  45.   out dx,al
  46.   inc al
  47.   cmp al,63
  48.   jne @pal_loop1
  49.   @pal_loop2: ;set colors 63-127
  50.   out dx,al
  51.   out dx,al
  52.   out dx,al
  53.   dec al
  54.   jnz @pal_loop2
  55.   @pal_loop3: ;set colors 127-194
  56.   xchg al,ah
  57.   out dx,al
  58.   out dx,al
  59.   xchg al,ah
  60.   out dx,al
  61.   inc al
  62.   cmp al,63
  63.   jne @pal_loop3
  64.   @pal_loop4: ;set rest
  65.   xchg al,ah
  66.   out dx,al
  67.   out dx,al
  68.   xchg al,ah
  69.   out dx,al
  70.   dec al
  71.   jnz @pal_loop4
  72.  
  73.   @main_loop:
  74.   call update_bobe      ;Make bobe. Update coordinates
  75.   cmp byte ptr cs:[offset temp_count],speedy
  76.   jne @no_text
  77.   mov byte ptr cs:[offset temp_count],0
  78.   call dotext
  79.   @no_text:
  80.   inc byte ptr cs:[offset temp_count]
  81.   mov ah,1
  82.   int 16h
  83.   jz  @main_loop
  84.   mov ax,3
  85.   int 10h
  86.   push cs      ;Display last message
  87.   pop ds
  88.   mov dx,offset endansi
  89.   mov ah,9
  90.   int 21h
  91.   ret          ;Not actually very wise "exit to dos". Works fine with COM files
  92.  
  93. Update_bobe     proc    near
  94. ;Move the shade bob
  95.                 pusha
  96.                 ;Update bob coordinates
  97.                 cmp     byte ptr cs:[offset bobexdir],0
  98.                 jne     @oikea
  99.                 add     word ptr cs:[offset bobex],2
  100.                 @oikea:
  101.                 dec     word ptr cs:[offset bobex]
  102.                 cmp     byte ptr cs:[offset bobeydir],0
  103.                 jne     @ylos
  104.                 add     word ptr cs:[offset bobey],2
  105.                 add     word ptr cs:[offset bobeyfast],640
  106.                 @ylos:
  107.                 dec     word ptr Cs:[offset bobey]
  108.                 sub     word ptr cs:[offset bobeyfast],320
  109.  
  110.                 ;Check if the bob is bouncing
  111.                 cmp     word ptr cs:[offset bobey],199-bobesize
  112.                 jle     @ei_ylos
  113.                 mov     byte ptr cs:[offset bobeydir],1
  114.                 @ei_ylos:
  115.                 cmp     word ptr cs:[offset bobey],bobesize
  116.                 jge     @ei_alas
  117.                 mov     byte ptr cs:[offset bobeydir],0
  118.                 @ei_alas:
  119.                 cmp     word ptr cs:[offset bobex],319-bobesize
  120.                 jle     @ei_vasen
  121.                 mov     byte ptr cs:[offset bobexdir],1
  122.                 @ei_vasen:
  123.                 cmp     word ptr cs:[offset bobex],0
  124.                 jg      @ei_oikea
  125.                 mov     byte ptr cs:[offset bobexdir],0
  126.                 @ei_oikea:
  127.  
  128. ;Make shade bob
  129.                 mov si,cs:[offset bobeyfast]
  130.                 add si,cs:[offset bobex]
  131.                 xor bx,bx
  132.                 mov dx,bobesize
  133.                 @y_loop:
  134.                 mov cx,bobesize
  135.                 @x_loop:
  136.                 mov al,es:[si]
  137.                 add al,cs:[offset bobe+bx]
  138.                 inc bx
  139.                 mov es:[si],al
  140.                 inc si
  141.                 loop @x_loop
  142.                 add si,320-bobesize
  143.                 dec dx
  144.                 jnz @y_loop
  145.                 popa
  146.                 ret
  147. update_bobe     endp
  148.  
  149. dotext          proc    near  ;DS:BP = pointer to font table
  150.                 pusha
  151.                 ;Display text
  152.                 mov di,cs:[offset xplace]
  153.                 mov si,cs:[offset char_counter]
  154.                 xor bh,bh
  155.                 mov bl,cs:[offset txt+si] ;Load character to BX
  156.                 shl bx,3
  157.                 add bp,bx                 ;Now BP points to character bitmap data
  158.                 xor bx,bx
  159.  
  160.                 mov dx,8                  ;Horizontal counter
  161.                 @horiz_loop:
  162.                 mov cx,8
  163.                 @vert_loop:
  164.                 mov al,ds:[bp]
  165.                 and al,cs:[offset translat+bx]
  166.                 cmp al,0
  167.                 je  @ei_pikseli
  168.                 mov al,62
  169.                 @ei_pikseli:
  170.                 mov es:[di],al
  171.                 add di,320                ;Next row
  172.                 inc bp
  173.                 loop @vert_loop
  174.                 inc bx
  175.                 sub di,320*8-1
  176.                 sub bp,8
  177.                 dec dx
  178.                 jnz @horiz_loop
  179.  
  180.                 ;Update message counters
  181.                 add word ptr cs:[offset xplace],9
  182.                 inc word ptr cs:[offset char_counter]  ;Next character
  183.                 mov si,cs:[offset char_counter]
  184.                 cmp byte ptr cs:[offset txt+si],0      ;End of the line?
  185.                 jne @no_clear                          ;NOT! Don't change counters
  186.                 mov word ptr cs:[offset xplace],0
  187.                 inc word ptr cs:[offset char_counter]
  188.                 @no_clear:
  189.                 cmp byte ptr cs:[offset txt+si],1      ;End of text?
  190.                 jne @fake_end
  191.                 mov word ptr cS:[offset char_counter],0 ;End of text! Clear character counter
  192.                 mov word ptr cs:[offset xplace],0
  193.                 @fake_end:
  194.                 popa
  195.                 ret
  196. dotext          endp
  197.  
  198. include bobe.inc ;Guess what this file includes?
  199.  
  200. ;TXT could be RLE coded. But hey, in these dayz of Giga Warez
  201. ;and 500 Meg HD's ... Who cares about ten bytes?
  202. txt             db 'Hi, What You See is All You Get',0
  203.                 db 'Smash a key !FAST!             ',0
  204.                 db 'Still watching?                ',0
  205.                 db 'Okay, greetings coming',0
  206.                 db 'Juffo-WUP             ',0
  207.                 db 'Nordic Vision',0
  208.                 db 'bReAdFaN     ',0
  209.                 db 'Kingi        ',0
  210.                 db 'Pete         ',0
  211.                 db 'all the other c00l guys',0
  212.                 db 'btw. The shitro made by LÖKÖ   ',0
  213.                 db 'beware. tXt will repeat        ',1
  214.  
  215. speedy          EQU 140    ;Draw text each 140th frame
  216.  
  217. endansi         db 27,'[36m"Great" 1K Shitro by LÖKÖ',27,'[0m',0dh,0ah,'$'
  218.  
  219. ;Some variables
  220. bobex           dw bobesize+1
  221. bobey           dw bobesize+1
  222. bobeyfast       dw (bobesize+1)*320
  223. translat        db 128,64,32,16,8,4,2,1
  224. char_counter    dw 0
  225. xplace          dw 0
  226. temp_count      db ?
  227. bobexdir        db ?
  228. bobeydir        db ?
  229.  
  230. cseg ends
  231.      end start
  232.